<%@page import="controller.UsuariosRolesMgr"%>
<%@page import="model.UsuariosRoles"%>
<%@page import="controller.RolesMgr"%>
<%@page import="java.util.ArrayList"%>
<%@page import="controller.EmpresasMgr"%>
<%@page import="model.Empresas"%>
<%@page import="java.util.List"%>
<%@page import="model.Roles"%>
<%@page import="controller.UsuariosMgr"%>
<%@page import="model.Usuarios"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
            HttpSession currentSession = request.getSession();
            String doc = currentSession.getAttribute("id") == null ? "" : (String) currentSession.getAttribute("id");
            String html = "";
            
            if ( doc.equals("")) {
                response.sendRedirect("/GGP/index.jsp");
            } else {
           
            
            Usuarios user = UsuariosMgr.mgr.getUsuario(doc);
            Empresas miEmpresa=EmpresasMgr.mgr.getItemForNit(user.nitEmpresa);

            String opt = request.getParameter("opt") == null ? "" : request.getParameter("opt");

             ArrayList<Roles> lstRolesActual = RolesMgr.mgr.getListPorUsuario(doc);
             Roles rolActual = new Roles();
             if (lstRolesActual.size() > 0) {
                    rolActual = lstRolesActual.get(0);
              }

            String alert = "";

            if (!opt.equals("")) {

                String opc = request.getParameter("opc") == null ? "" : request.getParameter("opc");
                String editar = "";

                if (opt.equals("agregar")) {

                    Empresas data = new Empresas();

                    if (opc.equals("agregar")) {

                        data.nombre = request.getParameter("nombre") == null ? "" : request.getParameter("nombre");
                        data.nit = request.getParameter("nit") == null ? "" : request.getParameter("nit");
                        data.direccion = request.getParameter("direccion") == null ? "" : request.getParameter("direccion");
                        data.cantAdministradores = "1";
                        data.telefono = request.getParameter("telefono") == null ? "" : request.getParameter("telefono");
                        data.idPadre = user.nitEmpresa;
                        data.nivel = "0";

                        String edit = request.getParameter("editar") == null ? "" : request.getParameter("editar");
                        EmpresasMgr.mgr.execute(data.getUpdateSql2(edit.equals("1")));
                        if (!edit.equals("1")) {
                            RolesMgr.mgr.crearRolAdmin(data.nit);
                        }
                        response.sendRedirect("index.jsp?opt=buscar");
                    }

                    if (opc.equals("editar")) {
                        String idEmpresa = request.getParameter("idEmpresa") == null ? "" : request.getParameter("idEmpresa");
                        editar = "1";
                        data = EmpresasMgr.mgr.getItemForNit(idEmpresa);
                    }

                    html = "<form method='post' name='formAdd' target='_self' action='index.jsp' >"
                            + "<table width='' cellpadding='3' cellspacing='0'><input type='hidden' name='opc' value='agregar' />"
                            + "<input type='hidden' name='opt' value='agregar' />"
                            + "<input type='hidden' name='editar' value='" + editar + "' />"
                            + "<tr><td colspan='2' class='st1'>Agregar Ingreso</td></tr>";
                    if (editar.equals("1")) {
                        html += "<tr><td class='st3'>Nit :</td><td class='st4'>" + data.nit + "&nbsp;</td></tr>"
                                + "<input type='hidden' name='nit' value='" + data.nit + "' />";
                    } else {
                        html += "<tr><td class='st3'>Nit :</td><td class='st4'><input type='text' id='nit' name='nit' value ='" + data.nit + "' size='50' /></td></tr>";
                    }

                    html += "<tr><td class='st3'>Nombre :</td><td class='st4'><input type='text' id='nombre' name='nombre' value ='" + data.nombre + "' size='50' /></td></tr>"
                            + "<tr><td class='st3'>Dirección :</td><td class='st4'><input type='text' id='direccion' name='direccion' value ='" + data.direccion + "' size='50' /></td></tr>"
                            + "<tr><td class='st3'>Teléfono :</td><td class='st4'><input type='text' id='telefono' name='telefono' value ='" + data.telefono + "' size='50' /></td></tr>"
                            + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                            + "</table>"
                            + "</form>";
                }

                if (opt.equals("empleados")) {

                    String idEmpleado = request.getParameter("idEmpleado") == null ? "" : request.getParameter("idEmpleado");
                    Usuarios data = UsuariosMgr.mgr.getItemForCedula(idEmpleado);

                    if (opc.equals("guardar")) {
                        data.nombre = request.getParameter("nombre") == null ? "" : request.getParameter("nombre");
                        data.cedula = request.getParameter("cedula") == null ? "" : request.getParameter("cedula");
                        //data.clave = request.getParameter("clave") == null ? "" : request.getParameter("clave");
                        data.clave = "1234";
                        data.telefono = request.getParameter("telefono") == null ? "" : request.getParameter("telefono");
                        data.correo = request.getParameter("correo") == null ? "" : request.getParameter("correo");
                        data.nitEmpresa = user.nitEmpresa;
                        String rol = request.getParameter("permisos") == null ? "" : request.getParameter("permisos");

                        UsuariosMgr.mgr.save(data);
                        UsuariosRoles ur = new UsuariosRoles();
                        ur.cedulaUsuario = data.cedula;
                        ur.rolUsuario = rol;
                        UsuariosRolesMgr.mgr.save(ur);
                        response.sendRedirect("index.jsp?opt=empleados");

                    }

                    if (opc.equals("guardar_passwd")){
                        String clave = request.getParameter("clave") == null ? "" : request.getParameter("clave");
                        String confClave = request.getParameter("confClave") == null ? "" : request.getParameter("confClave");

                        if (clave.equals(confClave)){
                            UsuariosMgr.mgr.cambiarClave(idEmpleado, clave);
                            alert = "La Contraseña del usuario ha sido reestablecida";
                        }else{
                            alert = "Las Contraseñas ingresadas no coinciden";
                        }
                        opc = "alert";

                    }

                    if (opc.equals("eliminar")) {

                        UsuariosMgr.mgr.eliminarUsuario(idEmpleado);
                    }

                    ArrayList<Usuarios> lst = UsuariosMgr.mgr.getListForEmpresa(user.nitEmpresa);

                    html = "<table cellpadding='3' cellspacing='0'>"
                            + "<tr><td colspan='8' class='st1'>Empleados</td></tr><tr>"
                            + "<td class='st2left'>&nbsp</td>"
                            + "<td class='st2right'>CÉDULA</td>"
                            + "<td class='st2right'>NOMBRE</td>"
                            + "<td class='st2right'>TELEFONO</td>"
                            + "<td class='st2right'>CORREO</td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/edit.png' /></td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/define_permissions.png' /></td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/12.png' /></td></tr>";

                    for (Usuarios it : lst) {
                        html += "<tr><td class='st3'>&nbsp;</td>" + it.getHtmlRow();

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpleado' value='" + it.cedula + "' />"
                                + "<input type='hidden' name='opc' value='editar' />"
                                + "<input type='hidden' name='opt' value='empleados' />"
                                + "<input type='image' border='0' title='editar' src='../images/edit.png' /></form></td>";

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpleado' value='" + it.cedula + "' />"
                                + "<input type='hidden' name='opc' value='passwd' />"
                                + "<input type='hidden' name='opt' value='empleados' />"
                                + "<input type='image' border='0' title='contraseña' src='../images/define_permissions.png' /></form></td>";

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpleado' value='" + it.cedula + "' />"
                                + "<input type='hidden' name='opc' value='eliminar' />"
                                + "<input type='hidden' name='opt' value='empleados' />"
                                + "<input type='image' border='0' title='eliminar' src='../images/12.png' /></form></td></tr>";
                    }

                    html += "<tr><td class='st3' align='right' colspan='8'><form title='Agregar Empleados' method='post' action='index.jsp' target='_self'>"
                            + "<input type='hidden' name='opc' value='agregar' />"
                            + "<input type='hidden' name='opt' value='empleados' />"
                            + "<input type='image' border = '0' title='agregar' src='../images/11.png' />"
                            + "</form></td></tr></table>";

                    if (opc.equals("editar") || opc.equals("agregar")) {

                        editar = "";
                        if (!data.cedula.equals("")) {
                            editar = "1";
                        }


                        html += "<br><br><form method='post' name='formAdd' target='_self' action='index.jsp' >"
                                + "<table width='' cellpadding='3' cellspacing='0'><input type='hidden' name='opc' value='guardar' />"
                                + "<input type='hidden' name='opt' value='empleados' />"
                                + "<input type='hidden' name='editar' value='" + editar + "' />"
                                + "<tr><td colspan='2' class='st1'>Agregar Rol</td></tr>";

                        if (editar.equals("1")) {
                            html += "<tr><td class='st3'>Cédula:</td><td class='st4'>" + data.cedula + "&nbsp;</td></tr>"
                                    + "<input type='hidden' name='cedula' value='" + data.cedula + "' />";
                        } else {
                            html += "<tr><td class='st3'>Cédula :</td><td class='st4'><input type='text' id='cedula' name='cedula' value ='" + data.cedula + "' size='50' /></td></tr>";
                        }

                        ArrayList<Roles> lstRoles = RolesMgr.mgr.getListPorUsuario(idEmpleado);
                        Roles rol = new Roles();
                        if (lstRoles.size() > 0) {
                            rol = lstRoles.get(0);
                        }

                        lstRoles = RolesMgr.mgr.getListForEmpresa(user.nitEmpresa);

                        html += "<tr><td class='st3'>Nombre :</td><td class='st4'><input type='text' id='nombre' name='nombre' value ='" + data.nombre + "' size='50' /></td></tr>"
                                //+ "<tr><td class='st3'>Clave:</td><td class='st4'><input type='password' id='clave' name='clave' value ='" + data.clave + "' size='50' /></td></tr>"
                                + "<tr><td class='st3'>Teléfono:</td><td class='st4'><input type='text' id='telefono' name='telefono' value ='" + data.telefono + "' size='50' /></td></tr>"
                                + "<tr><td class='st3'>Correo:</td><td class='st4'><input type='text' id='correo' name='correo' value ='" + data.correo + "' size='50' /></td></tr>"
                                + "<tr><td class='st3'>Rol:</td><td class='st4'><select  name='permisos' id='permisos' value = '" + rol.idRol + "' >";

                        for (Roles it : lstRoles) {

                            html += "<option value='" + it.idRol + "' >" + it.nombreRol + "</option>";
                        }

                        html += "</select></td></tr><tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                                + "</table>"
                                + "</form>";
                    }

                    if (opc.equals("passwd")) {
                        html += "<br><br><form method='post' name='formPaswd' target='_self' action='index.jsp' >"
                                + "<table width='' cellpadding='3' cellspacing='0'><input type='hidden' name='opc' value='guardar_passwd' />"
                                + "<input type='hidden' name='opt' value='empleados' />"
                                + "<input type='hidden' name='idEmpleado' value='"+idEmpleado+"' />"
                                + "<tr><td colspan='2' class='st1'>Cambiar Password</td></tr>"
                                + "<tr><td class='st3'>Clave :</td><td class='st4'><input type='password' id='clave' name='clave' value ='' size='50' /></td></tr>"
                                + "<tr><td class='st3'>Confirmar Clave :</td><td class='st4'><input type='password' id='confClave' name='confClave' value ='' size='50' /></td></tr>"
                                + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                                + "</table>"
                                + "</form>";

                    }

                    if (opc.equals("alert")){
                        html += "<br><br><form method='post' name='formAlert' target='_self' action='index.jsp' >"
                                + "<table width='' cellpadding='3' cellspacing='0'>"
                                + "<input type='hidden' name='opt' value='empleados' />"
                                + "<tr><td colspan='2' class='st1'>"+alert+"</td></tr>"
                                + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                                + "</table>"
                                + "</form>";
                    }

                }

                if (opt.equals("roles")) {

                    String idRol = request.getParameter("idRol") == null ? "" : request.getParameter("idRol");
                    Roles data = RolesMgr.mgr.getItemForId(idRol);

                    if (opc.equals("eliminar")) {
                        RolesMgr.mgr.eliminarRoles(idRol);
                    }

                    if (opc.equals("guardar")) {

                        String edit = request.getParameter("editar") == null ? "" : request.getParameter("editar");

                        data.nombreRol = request.getParameter("nombreRol") == null ? "" : request.getParameter("nombreRol");
                        data.permisos = request.getParameter("permisos") == null ? "" : request.getParameter("permisos");
                        data.nitEmpresa = user.nitEmpresa;

                        RolesMgr.mgr.execute(data.getUpdateSql2(edit.equals("1")));
                    }

                    ArrayList<Roles> lst = RolesMgr.mgr.getListForEmpresa(user.nitEmpresa);

                    html = "<table cellpadding='3' cellspacing='0'>"
                            + "<tr><td colspan='5' class='st1'>Roles</td></tr><tr>"
                            + "<td class='st2left'>&nbsp</td>"
                            + "<td class='st2right'>NOMBRE</td>"
                            + "<td class='st2right'>PERMISOS</td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/edit.png' /></td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/12.png' /></td></tr>";

                    for (Roles it : lst) {
                        html += "<tr><td class='st3'>&nbsp;</td>" + it.getHtmlRow();

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idRol' value='" + it.idRol + "' />"
                                + "<input type='hidden' name='opc' value='editar' />"
                                + "<input type='hidden' name='opt' value='roles' />"
                                + "<input type='image' border='0' title='editar' src='../images/edit.png' /></form></td>";

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idRol' value='" + it.idRol + "' />"
                                + "<input type='hidden' name='opc' value='eliminar' />"
                                + "<input type='hidden' name='opt' value='roles' />"
                                + "<input type='image' border='0' title='eliminar' src='../images/12.png' /></form></td></tr>";
                    }

                    html += "<tr><td class='st3' align='right' colspan='5'><form title='Agregar Roles' method='post' action='index.jsp' target='_self'>"
                            + "<input type='hidden' name='opc' value='agregar' />"
                            + "<input type='hidden' name='opt' value='roles' />"
                            + "<input type='image' border = '0' title='agregar' src='../images/11.png' />"
                            + "</form></td></tr></table>";

                    if (opc.equals("agregar") || opc.equals("editar")) {

                        editar = "";
                        if (!data.idRol.equals("")) {
                            editar = "1";
                        }

                        html += "<br><br><form method='post' name='formAdd' target='_self' action='index.jsp' >"
                                + "<table width='' cellpadding='3' cellspacing='0'><input type='hidden' name='opc' value='guardar' />"
                                + "<input type='hidden' name='opt' value='roles' />"
                                + "<input type='hidden' name='idRol' value='" + idRol + "' />"
                                + "<input type='hidden' name='editar' value='" + editar + "' />"
                                + "<tr><td colspan='2' class='st1'>Agregar Rol</td></tr>";
                        html += "<tr><td class='st3'>Nombre :</td><td class='st4'><input type='text' id='nombreRol' name='nombreRol' value ='" + data.nombreRol + "' size='50' /></td></tr>"
                                + "<tr><td class='st3'>Permisos (*):</td><td class='st4'><select  name='permisos' id='permisos' value = '" + data.permisos + "' ><option value='1' >Administrador</option><option value='0' >Consultor</option><option value='-1' >Ninguno</option></select></td></tr>"
                                + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                                + "</table></form>";
                    }

                }

                if (opt.equals("admin")) {
                    String idEmpresa = request.getParameter("idEmpresa") == null ? "" : request.getParameter("idEmpresa");
                    Empresas data = EmpresasMgr.mgr.getItemForNit(idEmpresa);
                    Usuarios admin = UsuariosMgr.mgr.getSuperAdmin(idEmpresa);

                    if (opc.equals("agregar")) {

                        admin.nombre = request.getParameter("nombre") == null ? "" : request.getParameter("nombre");
                        admin.cedula = request.getParameter("cedula") == null ? "" : request.getParameter("cedula");
                        //admin.clave = request.getParameter("clave") == null ? "" : request.getParameter("clave");
                        admin.clave = "1234";
                        admin.telefono = request.getParameter("telefono") == null ? "" : request.getParameter("telefono");
                        admin.correo = request.getParameter("correo") == null ? "" : request.getParameter("correo");
                        admin.nitEmpresa = idEmpresa;

                        UsuariosMgr.mgr.save(admin);
                        UsuariosRoles ur = new UsuariosRoles();
                        Roles r = RolesMgr.mgr.getRolSuperAdmin(idEmpresa);
                        ur.cedulaUsuario = admin.cedula;
                        ur.rolUsuario = r.idRol;
                        UsuariosRolesMgr.mgr.save(ur);
                        response.sendRedirect("index.jsp?opt=buscar");
                    }

                    html = "<form method='post' name='formAdd' target='_self' action='index.jsp' >"
                            + "<table width='' cellpadding='3' cellspacing='0'><input type='hidden' name='opc' value='agregar' />"
                            + "<input type='hidden' name='opt' value='admin' />"
                            + "<input type='hidden' name='idEmpresa' value='" + idEmpresa + "' />"
                            + "<tr><td colspan='2' class='st1'>Agregar Administrador de " + data.nombre + "</td></tr>"
                            + "<tr><td class='st3'>Cédula :</td><td class='st4'><input type='text' id='nit' name='cedula' value ='" + admin.cedula + "' size='50' /></td></tr>"
                            + "<tr><td class='st3'>Nombre :</td><td class='st4'><input type='text' id='nombre' name='nombre' value ='" + admin.nombre + "' size='50' /></td></tr>"
                            //+ "<tr><td class='st3'>Clave :</td><td class='st4'><input type='password' id='clave' name='clave' value ='" + admin.clave + "' size='50' /></td></tr>"
                            + "<tr><td class='st3'>Teléfono :</td><td class='st4'><input type='text' id='telefono' name='telefono' value ='" + admin.telefono + "' size='50' /></td></tr>"
                            + "<tr><td class='st3'>Correo :</td><td class='st4'><input type='text' id='correo' name='correo' value ='" + admin.correo + "' size='50' /></td></tr>"
                            + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                            + "</table>"
                            + "</form>";
                }

                if (opt.equals("buscar")) {

                    String idEmpresa = request.getParameter("idEmpresa") == null ? "" : request.getParameter("idEmpresa");
                        
                    if (opc.equals("eliminar")) {
                        EmpresasMgr.mgr.eliminar(idEmpresa);
                    }

                    if (opc.equals("guardar_passwd")){
                        Usuarios admin = UsuariosMgr.mgr.getSuperAdmin(idEmpresa);
                        String clave = request.getParameter("clave") == null ? "" : request.getParameter("clave");
                        String confClave = request.getParameter("confClave") == null ? "" : request.getParameter("confClave");

                        if (clave.equals(confClave)){
                            UsuariosMgr.mgr.cambiarClave(admin.cedula, clave);
                            alert = "La Contraseña del usuario ha sido reestablecida";
                        }else{
                            alert = "Las Contraseñas ingresadas no coinciden";
                        }
                        opc = "alert";

                    }

                    ArrayList<Empresas> lst = EmpresasMgr.mgr.getEmpresasHijas(user.nitEmpresa);

                    html = "<table cellpadding='3' cellspacing='0'>"
                            + "<tr><td colspan='9' class='st1'>Empresas Siguiente Nivel</td></tr><tr>"
                            + "<td class='st2left'>&nbsp</td>"
                            + "<td class='st2right'>NIT</td>"
                            + "<td class='st2right'>NOMBRE</td>"
                            + "<td class='st2right'>DIRECCION</td>"
                            + "<td class='st2right'>TELEFONO</td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/edit.png' /></td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/38.png' /></td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/define_permissions.png' /></td>"
                            + "<td align='center' class='st2right'><img border='0' src='../images/12.png' /></td></tr>";

                    for (Empresas it : lst) {
                        html += "<tr><td class='st3'>&nbsp;</td>" + it.getHtmlRow();

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpresa' value='" + it.nit + "' />"
                                + "<input type='hidden' name='opc' value='editar' />"
                                + "<input type='hidden' name='opt' value='agregar' />"
                                + "<input type='image' border='0' title='editar' src='../images/edit.png' /></form></td>";

                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpresa' value='" + it.nit + "' />"
                                + "<input type='hidden' name='opt' value='admin' />"
                                + "<input type='image' border='0' title='administrador' src='../images/38.png' /></form></td>";

                                                html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpresa' value='" + it.nit + "' />"
                                + "<input type='hidden' name='opc' value='passwd' />"
                                + "<input type='hidden' name='opt' value='buscar' />"
                                + "<input type='image' border='0' title='contraseña' src='../images/define_permissions.png' /></form></td>";


                        html += "<td align='center' class='st4right'><form title='' method='post' action='index.jsp' target='_self'>"
                                + "<input type='hidden' name='idEmpresa' value='" + it.nit + "' />"
                                + "<input type='hidden' name='opc' value='eliminar' />"
                                + "<input type='hidden' name='opt' value='buscar' />"
                                + "<input type='image' border='0' title='eliminar' src='../images/12.png' /></form></td></tr>";
                    }
                    html += "<tr><td class='st3' align='right' colspan='9'></td></tr></table>";
                
                    if (opc.equals("passwd")) {
                        html += "<br><br><form method='post' name='formPaswd' target='_self' action='index.jsp' >"
                                + "<table width='' cellpadding='3' cellspacing='0'><input type='hidden' name='opc' value='guardar_passwd' />"
                                + "<input type='hidden' name='opt' value='buscar' />"
                                + "<input type='hidden' name='idEmpresa' value='"+idEmpresa+"' />"
                                + "<tr><td colspan='2' class='st1'>Cambiar Password</td></tr>"
                                + "<tr><td class='st3'>Clave :</td><td class='st4'><input type='password' id='clave' name='clave' value ='' size='50' /></td></tr>"
                                + "<tr><td class='st3'>Confirmar Clave :</td><td class='st4'><input type='password' id='confClave' name='confClave' value ='' size='50' /></td></tr>"
                                + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                                + "</table>"
                                + "</form>";

                    }

                    if (opc.equals("alert")){
                        html += "<br><br><form method='post' name='formAlert' target='_self' action='index.jsp' >"
                                + "<table width='' cellpadding='3' cellspacing='0'>"
                                + "<input type='hidden' name='opt' value='buscar' />"
                                + "<tr><td colspan='2' class='st1'>"+alert+"</td></tr>"
                                + "<tr><td class='st3' colspan='2' align='right'><input type='image' onclick='return formAdd_validar()' src='../images/10.png'></td></tr>"
                                + "</table>"
                                + "</form>";
                    }

                }
            }

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Merchant Manager</title>
        <link href="../main.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
<div id="page">
	<div id="header">
			<h1>Merchant Manager</h1>
			<div class="description">Usuario: <%=user.nombre%> / Empresa: <%=miEmpresa.nombre%> / Rol: <%=rolActual.nombreRol%> </div>
	</div>

	<div id="mainarea">
	<div id="sidebar">
		<div id="sidebarnav">
                    <a href="empresas.jsp">Empresas</a>
                    <a href="roles.jsp">Roles</a>
                    <a href="empleados.jsp">Empleados</a>
                    <a href="../cerrar.jsp">Cerrar Sesión</a>
                    <a href="#">Ayuda</a>
	</div>
</div>

<div id="contentarea">


<%=html%>
               
</div>
</div>
<div id="footer">
Copyright &copy; 2011 - UNDeveloper 
</div>
</div>
</body>
</html>
<%
}
%>